{extend name="../back" /}
{block name="main"}
<div class="w-100 d-flex justify-content-start align-items-center mb-3">
  <div class="dropdown">
    <button type="button" class="btn btn-dark btn-sm dropdown-toggle" data-bs-toggle="dropdown"><i class="bi-tools mx-1"></i>批量操作</button>
    <div class="dropdown-menu">
      <a class="dropdown-item xf-batch" href="{:xfUrl('admin/user/normal')}"><i class="bi-eye me-1"></i>显示</a>
      <a class="dropdown-item xf-batch" href="{:xfUrl('admin/user/hidden')}"><i class="bi-eye-slash me-1"></i>隐藏</a>
      <li><hr class="dropdown-divider"></li>
      <a class="dropdown-item xf-batch" href="{:xfUrl('admin/user/deletes')}" data-delete="1"><i class="bi-trash me-1 text-danger"></i>删除</a>
    </div>
  </div>
  <div class="btn-group btn-group-sm ms-3" role="group">
    <a class="btn btn-secondary" href="{:xfUrl('admin/user/create')}" data-toggle="create"><i class="bi-plus mx-1"></i>添加</a>
    <a class="btn btn-secondary" href="{:xfUrl('admin/user/index')}"><i class="bi-list mx-1"></i>全部</a>
    <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="bi-sort-down"></i>排序</button>
    <div class="dropdown-menu">
      <a class="dropdown-item {:xfActive($query['sortOrder'],'user_id')}" href="{:xfUrl('admin/user/index',['sortOrder'=>'user_id'])}">ID</a>
      <a class="dropdown-item {:xfActive($query['sortOrder'],'user_score')}" href="{:xfUrl('admin/user/index',['sortOrder'=>'user_score'])}">积分</a>
      <a class="dropdown-item {:xfActive($query['sortOrder'],'user_update_time')}" href="{:xfUrl('admin/user/index',['sortOrder'=>'user_create_time'])}">注册时间</a>
      <a class="dropdown-item {:xfActive($query['sortOrder'],'user_update_time')}" href="{:xfUrl('admin/user/index',['sortOrder'=>'user_update_time'])}">登录时间</a>
    </div>
  </div>
  <form class="ms-3" action="{:xfUrl('admin/user/index')}" method="get">
    <div class="input-group input-group-sm">
      <input  class="form-control" type="text" name="searchText" placeholder="邮箱/手机号/用户名" autocomplete="off" required>
      <button class="btn btn-secondary" type="submit">搜索</button>
    </div>
  </form>
</div>
<table class="table table-striped table-bordered table-hover">
  <thead>
    <tr>
      <th><input name="checkAll" type="checkbox"></th>
      <th>ID</th>
      <th>用户名</th>
      <th>手机号</th>
      <th>邮箱</th>
      <th>状态</th>
      <th>角色</th>
      <th>注册时间</th>
      <th>登录时间</th>
      <th>注册IP</th>
      <th>登录IP</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    {volist name="list" id="item"}
    <tr>
      <td><input name="id[]" type="checkbox" value="{$item.user_id}"></td>
      <td>{$item.user_id}</td>
      <td>{$item.user_name}</td>
      <td>{$item.user_mobile}</td>
      <td>{$item.user_email|default='-'}</td>
      <td>{$item.user_status|xfStatus}</td>
      <td>{:implode(',',json_decode($item['user_roles'],true))}</td>
      <td>{$item.user_create_time|date='Y-m-d H:i:s'}</td>
      <td>{$item.user_update_time|date='Y-m-d H:i:s'}</td>
      <td>{$item.user_create_ip}</td>
      <td>{$item.user_update_ip}</td>
      <td>
        <a class="px-1 text-danger" href="{:xfUrl('admin/user/delete',['id'=>$item['user_id']])}" data-toggle="delete">删除</a>
        <a class="px-1 text-dark" href="{:xfUrl('admin/user/edit',['id'=>$item['user_id']])}" data-toggle="edit" target="_blank">修改</a>
      </td>
    </tr>
  {/volist}
  </tbody>
</table>
{$pages|raw}
{/block}